<?php if (!defined('THINK_PATH')) exit();?><style>
    .form-group label{width:85px}
</style>
<section class="content" >
    <div class="row">
        <div class="col-md-12">
            <div class="box box-danger">
                <div class="box-body">
                    <form id="site_public_editinfo_form">
                        <input type="hidden" name="id" value="<?php echo ($info["id"]); ?>" />
                        <div class="form-group">
                            <label style="display:inline-table">手机
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入手机号码" 
                                   class="form-control"  data-validation="length"
                                   data-validation-length="min1"
                                   name="mobile" value="<?php echo ($info["mobile"]); ?>"
                                   data-validation-error-msg="请输入正确手机号码"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">登录密码
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入登录密码"
                                   class="form-control"
                                   name="password"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">方量
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <?php if(is_array($carType)): foreach($carType as $key=>$vo): ?><input type="radio" value="<?php echo ($vo); ?>" name="load"  <?php if(($info['load']) == $vo): ?>checked="checked"<?php endif; ?>>&nbsp;&nbsp;<?php echo ($vo); ?>方<?php endforeach; endif; ?>
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">车号
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入车号"
                                   class="form-control"
                                   name="carno" value="<?php echo ($info["carno"]); ?>"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">联系人
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入联系人"
                                   class="form-control"  data-validation="length"
                                   data-validation-length="min1"
                                   name="name" value="<?php echo ($info["name"]); ?>"
                                   data-validation-error-msg="请输入联系人"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">状态
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <label>
                                <input type="radio" value="0" name="status"
                                <?php if(($info['status']) == "0"): ?>checked="checked"<?php endif; ?>
                                <?php if(($info['status']) == ""): ?>checked="checked"<?php endif; ?>
                                >&nbsp;&nbsp;启用
                            </label>
                            <label>
                                <input type="radio" value="1" name="status"
                                <?php if(($info['status']) == "1"): ?>checked="checked"<?php endif; ?>
                                >&nbsp;&nbsp;停用
                            </label>
                        </div>
                        <?php if($roleid == 1): ?><div class="form-group">
                            <label style="display:inline-table">站点
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <select class="select2 " name="site" style="width: 60%">
                                <option value="0" <?php if(($info['site']) == "0"): ?>selected<?php endif; ?> >无站点</option>
                                <?php if(is_array($sites)): foreach($sites as $key=>$site): ?><option value="<?php echo ($site['id']); ?>" <?php if(($info['site']) == $site['id']): ?>selected<?php endif; ?> ><?php echo ($site['name']); ?></option><?php endforeach; endif; ?>
                            </select>
                        </div><?php endif; ?>
                        <div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-danger pull-left" type="button"  id="close-dialog">取消</button>
                                <button class="btn btn-primary pull-right" type="button" id='site_public_editinfo_form_submit'>提交</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $(".select2").select2({minimumResultsForSearch: -1});
            $('#site_public_editinfo_form_submit').click(function () {
                $('#site_public_editinfo_form').submit();
            });
            $.validate({
                onSuccess: function () {
                    publicEditinfoFormSubmit();
                    return false;
                }
            });
        });

        function publicEditinfoFormSubmit() {
            $.post("<?php echo U('Car/add');?>",
                    $("#site_public_editinfo_form").serialize(), function (res) {
                if (!res.status) {
                    $.messager.alert('提示信息', res.info, 'error');
                } else {
                    $.messager.alert('提示信息', res.info, 'info');
                    dialog.get('dialogPage').close().remove();
                    reloadContent();
                }
            });
            return false;
        }

    </script>
</section>